<template>
    <div class="command-readline">
        <ul>
            <li v-for="(item, index) in lists" :key="index">
                <span v-if="_.isString(item)">{{ item }}</span>
                <span v-else :class="{'color-danger': item.getCode() > 0}">{{ item.getMsg() }}</span>
            </li>
        </ul>
<!--        <p :class="{'color-danger': item.getCode() > 0}">{{ item.getMsg() }}</p>-->
        <el-empty description="暂无数据" v-if="!lists.length"></el-empty>
    </div>
</template>

<script>
export default {
    data () {
        return {

        }
    },
    computed: {
        lists() {
            return this.$store.state.goservice.command.history;
        }
    },
    watch: {
        lists() {
            // 滚动到最底部
            let div = $('.command-window .el-dialog__body')[0];
            div.scrollTo(0, div.offsetHeight);
        }
    },
    methods: {

    }
}
</script>

<style lang="scss" scoped>
.command-readline {
    ul {
        list-style: none;

        li {
            font-size: 12px;
            line-height: 18px;
            color: white;
        }
    }
}
</style>
